cdec_template.RmdThe California Data Exchange Center (CDEC) is a consolidated interface for hydrologic and climate data collected by multiple agencies across the state of California, reporting historic and real-time streamflow, stage, precipitation, snowpack, reservoir level, temperature, water quality, and more.
Station IDs follow a 3-character alphanumeric format. When the ID is known, the station metadata can be looked up using the following URL pattern:
https://cdec.water.ca.gov/dynamicapp/staMeta?station_id={XXX}
CDEC has an station locator map located at https://cdec.water.ca.gov/webgis/?appid=cdecstation
Stations can also be queried by river basin. For the greater Sacramento-San Joaquin basin, this includes the following river basins:
## AMERICAN RIVER, BATTLE CREEK, BEAR RIVER, BUTTE CREEK, CACHE CREEK, CALAVERAS RIVER, COSUMNES RIVER, COTTONWOOD CREEK, DELTA, FEATHER RIVER, KERN RIVER, KINGS RIVER, MC CLOUD RIVER, MERCED RIVER, MOKELUMNE RIVER, PIT RIVER, PUTAH CREEK, SACRAMENTO RIVER, SACTO VLY NE, SACTO VLY WEST, SAN JOAQUIN FLOOR, SAN JOAQUIN RIVER, SAN JOAQUIN VLY WEST, STANISLAUS RIVER, STONY CREEK, TUOLUMNE RIVER, YUBA RIVER
Refer to the station ID for which sensors are available at a particular station.
Following are the sensor codes that report some variation of flow in cfs. There are many other codes not listed here including stage, temperature, turbidity, etc.
20 = FLOW = FLOW,
RIVER DISCHARGE, CFS41 = MFLOW = FLOW,
MEAN DAILY, CFS110 = DIVERSN = FLOW,
CANAL DIVERSION, CFS23 = OUTFLOW =
RESERVOIR OUTFLOW, CFS76 = INFLOW =
RESERVOIR INFLOW, CFS7 = REL SCH =
SCHEDULED RELEASE, CFS (manually reported)210 = AUXFLOW = FLOW
AUX, CFS165 = FLOW.XX = FLOW,
RIVER DISCHARGE PRECISE, CFS (rarely used)8 = FNF = FULL
NATURAL FLOW, CFS (modeled)This report’s analysis of spatial and temporal coverage includes
sensors for in-stream flow (20, 41) that
monitor the full mainstem channel flow for selected major rivers and
creeks. Side channels and diversions are not included. Reservoir
outflows of the major Central Valley rim dams are also included as flow
data for their associated rivers.
A particular station sensor will have data available at one or more of these duration types. The station lookup page will describe which sensor-duration combinations are available.
E = EVENT (typically
15-minute intervals)H = HOURLY
D = DAILY
For example, BCK
has flow data (sensor 20) available at the 15-minute
(duration E) and hourly (duration H)
timesteps, as well as in a summarized daily mean format (sensor
41, duration D).
Data can be queried in CSV format using the following URL template, including the 3-digit station ID, the sensor and duration codes described above, and the start and end dates.
https://cdec.water.ca.gov/dynamicapp/req/CSVDataServlet?Stations={XXX}&SensorNums={XX}&dur_code={X}&Start={YYYY-MM-DD}&End={YYYY-MM-DD}
Data can be queried via the CDEC API. This is documented in PDFs linked at https://cdec.water.ca.gov/queryTools.html
Real-time, daily, monthly query options are available at the following link: https://cdec.water.ca.gov/queryTools.html
An alternate interface allows the user to query the most recent data by each sensor, listed out for an entire river basin: https://cdec.water.ca.gov/dynamicapp/getAll
CDECRetrieve
FlowWest developed the R package CDECRetrieve for
querying CDEC data. This package is documented at https://github.com/FlowWest/CDECRetrieve
and can be installed via:
The following section assesses spatial and temporal coverage of the stations.
The following chart summarizes the ranges of data availability. This is based on the published start and end dates and does not account for NA values within these ranges. Bear Creek and Paynes Creek are not listed in this figure because no stations are present. Calaveras River is included but data is only available from reservoir outflow.

The following table and chart summarize the percentage of non-missing observations, within each water year, by station and by channel/section.

## Simple feature collection with 194 features and 8 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -229375.1 ymin: -296689 xmax: 164997.5 ymax: 376934.1
## Projected CRS: NAD83 / California Albers
## # A tibble: 194 × 9
## # Groups: channel, section, station_id [194]
## channel section station_id station_name start_date end_date freq_avail
## * <chr> <fct> <chr> <chr> <date> <date> <chr>
## 1 American Ri… Americ… afo American Ri… 1998-11-02 2024-02-14 hourly
## 2 American Ri… Americ… amf American Ri… 1995-02-01 2001-05-08 daily
## 3 American Ri… Americ… amk South Fork … 2012-10-23 2024-02-14 hourly
## 4 American Ri… Americ… cbr South Fork … 1997-09-10 2024-02-14 hourly
## 5 American Ri… Americ… fol Folsom Lake 1987-01-05 2024-02-14 daily
## 6 American Ri… Americ… nfd North Fork … 1970-01-01 2005-11-30 hourly
## 7 American Ri… Americ… oxb Middle Fork… 1997-10-21 2024-02-14 hourly
## 8 Antelope Cr… Antelo… atc Antelope Cr… 2022-06-28 2024-02-14 hourly
## 9 Battle Creek Battle… bas South Fork … 2000-07-19 2024-02-14 hourly
## 10 Battle Creek Battle… bat Battle Creek 1986-10-01 2024-02-14 hourly
## # ℹ 184 more rows
## # ℹ 2 more variables: geometry <POINT [m]>, pct_complete <dbl>
(194 total stations)